package com.rongxun.common.base.mvvm.event;

import java.util.Map;

/**
 * 创建者     庄丰泽
 * 创建时间   2019/12/3 14:01
 * 描述
 * <p>
 * 更新者     $
 * 更新时间   $
 * 更新描述
 */
public final class UIChangeLiveData extends SingleLiveEvent {
    private SingleLiveEvent<Boolean>             showInitLoadViewEvent;
    private SingleLiveEvent<Boolean>             showTransLoadingViewEvent;
    private SingleLiveEvent<Boolean>             showNoDataViewEvent;
    private SingleLiveEvent<Boolean>             showNetWorkErrViewEvent;
    private SingleLiveEvent<Map<String, Object>> startActivityEvent;
    private SingleLiveEvent<Void>                finishActivityEvent;
    private SingleLiveEvent<Void>                onBackPressedEvent;

    public SingleLiveEvent<Boolean> getShowInitLoadViewEvent() {
        return showInitLoadViewEvent = createLiveData(showInitLoadViewEvent);
    }

    public SingleLiveEvent<Boolean> getShowTransLoadingViewEvent() {
        return showTransLoadingViewEvent = createLiveData(showTransLoadingViewEvent);
    }

    public SingleLiveEvent<Boolean> getShowNoDataViewEvent() {
        return showNoDataViewEvent = createLiveData(showNoDataViewEvent);
    }

    public SingleLiveEvent<Boolean> getShowNetWorkErrViewEvent() {
        return showNetWorkErrViewEvent = createLiveData(showNetWorkErrViewEvent);
    }

    public SingleLiveEvent<Map<String, Object>> getStartActivityEvent() {
        return startActivityEvent = createLiveData(startActivityEvent);
    }

    public SingleLiveEvent<Void> getFinishActivityEvent() {
        return finishActivityEvent = createLiveData(finishActivityEvent);
    }

    public SingleLiveEvent<Void> getOnBackPressedEvent() {
        return onBackPressedEvent = createLiveData(onBackPressedEvent);
    }

    private SingleLiveEvent createLiveData(SingleLiveEvent liveData) {
        if (liveData == null) {
            liveData = new SingleLiveEvent();
        }
        return liveData;
    }

}